<template>
  <div class="editTeam_box">
    <el-page-header @back="goBack" content="编辑队伍" style="margin-bottom: 20px">
    </el-page-header>
    <div class="table_box">
      <div class="gameName">{{ gameName }}</div>
      <div class="team_member">
        <production :team="team"></production>
        <students :students="students"></students>
        <teacher :teachers="teachers"></teacher>
      </div>
    </div>
  </div>
</template>

<script>
import students from "@/views/teams/children/components/students";
import teacher from "@/views/teams/children/components/teacher";
import production from "@/views/teams/children/components/production"
export default {
  name: "editAllTeam",
  components:{
    students,
    teacher,
    production
  },
  data() {
    return{
      team: {}, // 小组基本信息
      students: [],
      teachers: [],
      gameName: '',
    }
  },
  methods: {
    goBack() {
      window.sessionStorage.removeItem('teacher');
      window.sessionStorage.removeItem('groupID');
      window.sessionStorage.removeItem('team');
      this.$router.push('/backIndex/allTeam')
    },

    //  获取小组成员,指导老师
    getGroupManInfo(data){
      this.$api.getGroupManInfo(data)
          .then(res =>{
            this.students = res.data.groupManInfo;
          })
          .catch(err => {
            console.log(err);
          });
      const teacher = window.sessionStorage.getItem("teacher");
      if(teacher !== 'undefined'){
        this.teachers = JSON.parse(teacher);
      }
      this.team = JSON.parse(window.sessionStorage.getItem("team"));
      this.gameName = window.sessionStorage.getItem('gameName');
    }

  },
  mounted() {
    this.getGroupManInfo(window.sessionStorage.getItem("groupID"))
  }
}
</script>

<style lang="less" scoped>
.editTeam_box{
  .table_box{
    background-color: #ffffff;
    padding: 40px;
    box-shadow: 0 2px 7px rgba(187, 172, 172, 0.49), 0 5px 11px rgba(247, 231, 231, 0.36);
    .gameName{
      font-size: 30px;
      font-weight: bolder;
      text-align: center;
    }
    .team_member{
      width: 1300px;
      margin: 20px auto;
    }
  }

  //}

}
</style>
